var t, e, a = require("./@babel/runtime/helpers/interopRequireDefault"), o = a(require("./@babel/runtime/regenerator")), i = a(require("./@babel/runtime/helpers/asyncToGenerator"));

Page({
  data: {
      value: 0,
      val: 0,
      value2: 0,
      styles: [ {
          line: "#dbdbdb",
          bginner: "#fbfbfb",
          bgoutside: "#dbdbdb",
          lineSelect: "#52b8f5",
          font: "#404040"
      }, {
          line: "#dbdbdb",
          bginner: "#fbfbfb",
          bgoutside: "#dbdbdb",
          lineSelect: "#52b8f5",
          font: "#404040"
      } ],
      buttonTop: 400,
      buttonLeft: 0,
      windowHeight: "",
      windowWidth: "",
      min: 0,
      max: 100,
      step: 1,
      single: 8,
      isStart: !0,
      jiaozhi: 5.4,
      startzhi: 4.0001,
      jiaole: !1,
      jiaobuttontop: 0
  },
  onLoad: function(t) {
      var e = this;
      wx.getSystemInfo({
          success: function(t) {
              e.setData({
                  windowHeight: t.windowHeight,
                  windowWidth: t.windowWidth
              });
          }
      });
      var a = wx.getStorageSync("singlele"), o = wx.getStorageSync("startzhi"), i = wx.getStorageSync("endtop");
      "" == a ? e.setData({
          startzhi: e.data.startzhi.toFixed(2)
      }) : e.setData({
          startzhi: e.data.startzhi.toFixed(2),
          single: a
      }), "" === o && "" === i || (console.log(11111), console.log(i), e.setData({
          startzhi: o,
          buttonTop: i
      }));
  },
  buttonStart: function(e) {
      t = e.touches[0];
  },
  buttonMove: function(e) {
      var a = e.touches[e.touches.length - 1], o = (a.clientX, t.clientX, a.clientY - t.clientY);
      t = a;
      var i = this.data.buttonTop + o;
      if (i <= .1 * this.data.windowHeight && (i = .1 * this.data.windowHeight), i / 2 >= 1 * this.data.windowHeight && (i = 1 * this.data.windowHeight * 2), 
      this.data.isStart && !this.data.jiaole) {
          console.log("开始");
          var n = ((i / 10).toFixed(2) / 10).toFixed(2);
          this.setData({
              buttonTop: i,
              startzhi: n
          }), wx.setStorageSync("endtop", i), wx.setStorageSync("startzhi", n);
      } else if (this.data.isStart || this.data.jiaole) {
          if (this.data.jiaole) {
              console.log("挪动进入2");
              var s = ((i / 2 / this.data.jiaobuttontop).toFixed(2) / 10).toFixed(2);
              console.log(i + "但其方法"), this.setData({
                  buttonTop: i,
                  startzhi: s
              }), wx.setStorageSync("endtop", i), wx.setStorageSync("startzhi", s);
          }
      } else {
          console.log("挪动进入1");
          var r = (i / (216 / 56)).toFixed(2);
          console.log(r);
          var l = (r / 10).toFixed(2);
          console.log(l);
          var h = i / 54;
          console.log(h), this.setData({
              buttonTop: i
          }), wx.setStorageSync("endtop", i), wx.setStorageSync("startzhi", l);
      }
  },
  buttonEnd: function(t) {},
  onShareTimeline: function() {
      return {
          title: "给大家推荐一个能在手机上用的尺子：锤子工具人。",
          imageUrl: "http://file.scjrh.net/hammer/logo.png"
      };
  },
  onShareAppMessage: function(t) {
      var e = {
          title: "给你推荐一个直尺小工具",
          success: function(t) {
              t.errMsg;
          },
          fail: function() {
              "shareAppMessage:fail cancel" == res.errMsg || res.errMsg;
          }
      };
      return t.from, e;
  },
  jiaozhun: (e = (0, i.default)(o.default.mark(function t(e) {
      var a, i, n;
      return o.default.wrap(function(t) {
          for (;;) switch (t.prev = t.next) {
            case 0:
              a = this, i = wx.getStorageSync("jiaobuttontop"), n = wx.getStorageSync("startzhi"), 
              "" == i || "" == n ? a.setData({
                  isStart: !1,
                  buttonTop: 540,
                  jiaozhi: 5.4,
                  jiaole: !1
              }) : a.setData({
                  isStart: !1,
                  jiaole: !1,
                  buttonTop: i,
                  jiaozhi: 5.4
              });

            case 4:
            case "end":
              return t.stop();
          }
      }, t, this);
  })), function(t) {
      return e.apply(this, arguments);
  }),
  tap: function() {
      this.setData({
          x: 30,
          y: 30
      });
  },
  jiaozhunclose: function() {
      wx.setStorageSync("jiaobuttontop", this.data.buttonTop), wx.setStorageSync("startzhi", this.data.jiaozhi), 
      wx.setStorageSync("singlele", this.data.buttonTop / 67.5), console.log(this.data.buttonTop);
      this.setData({
          isStart: !0,
          startzhi: this.data.jiaozhi,
          jiaole: !0,
          single: this.data.buttonTop / 67.5,
          jiaobuttontop: this.data.buttonTop / 2 / 54
      }), console.log(this.data.buttonTop / 2 / 54, "比例");
  },
  bindvalue: function(t) {
      this.setData({
          value: t.detail.value
      });
  },
  bindvalue2: function(t) {
      this.setData({
          value2: t.detail.value
      });
  },
  assignment: function() {
      this.setData({
          val: 50
      });
  },
  changeheight: function(t) {
      console.log(t);
  }
});